<template>
  <el-dialog
    title="文件导入"
    :visible.sync="onoff"
    width="60%"
    class="uploadComponent"
    :before-close="handleClose"
  >
    <uploader :options="options" :file-status-text="statusText" class="uploader-example">
      <uploader-unsupport></uploader-unsupport>
      <uploader-drop>
        <!-- <p>Drop files here to upload or</p> -->
        <uploader-btn :attrs="attrs">选择文件</uploader-btn>
        <!-- <uploader-btn :attrs="attrs">select images</uploader-btn>
        <uploader-btn :directory="true">select folder</uploader-btn>-->
      </uploader-drop>
      <uploader-list></uploader-list>
    </uploader>
    <span slot="footer" class="dialog-footer">
      <el-button @click="handleClose">取 消</el-button>
      <el-button type="primary" @click="handleClose">确 定</el-button>
    </span>
  </el-dialog>
</template>

<script>
  export default {
    props:{
      onoff:{
        type:Boolean
      }
    },
    data () {
      return {
        options: {
          target: 'http://192.168.0.244:8081/file/uploadFile?upKey=4e240f24-cb74-44aa-8ae6-76ae213ffe42',
          testChunks: false,
          categoryMap:{
            document: ['doc','docx','pdf','xls', 'xlsx','ppt', 'pptx']
          } 
        },
        attrs: {
          accept: 'document/*'
        },
        statusText: {
          success: '完成',
          error: '出错了',
          uploading: '上传中',
          paused: '暂停中',
          waiting: '等待中'
        }
      }
    },
    methods:{
      handleClose(){
        this.$emit('update:onoff',false)
      },
      
    }
  }
</script>

<style>
  .uploadComponent{
    
  }
  .uploader-example {
    width: 100%;
    font-size: 12px;
  }
  .uploader-example .uploader-btn {
    margin-right: 4px;
  }
  .uploader-example .uploader-list {
    max-height: 440px;
    overflow: auto;
    overflow-x: hidden;
    overflow-y: auto;
  }
</style>